<style type="text/css">
    #region_address .n-error{
        margin-left: 250px;
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><a style="color: red">*</a>用戶:</label>
        <div class="col-xs-12 col-sm-8">
        <a data-url="user/user/caring_task_user" href="javascript:;"  class="btn btn-success spec_add_btn" data-title="選擇用戶" >選擇用戶</a>
        </div>
    </div>
    <div class="form-group" id="tag_f_div" style="display: none;">
        <label class="control-label col-xs-12 col-sm-2">已選擇用戶:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="tag_div" id="tag_div">
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><a style="color: red">*</a>義工:</label>
        <div class="col-xs-12 col-sm-8">
        <a data-url="volunteer/indexs/source/tasks" href="javascript:;"  class="btn btn-success spec_adds_btn" data-title="分配義工" >分配義工</a>
        </div>
    </div>
    <div class="form-group" id="tag_f_divs" style="display: none;">
        <label class="control-label col-xs-12 col-sm-2">已選擇用義工:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="tag_divs" id="tag_divs">
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><a style="color: red">*</a>{:__('Region_address')}:</label>
        <div class="row">
            <div class="col-xs-9" id="region_address">
                <div class="form-inline" data-toggle="cxselect" data-selects="province,city,area">
                    <select  data-rule="required" class="province form-control" name="province" data-url="region/area">
                    </select>
                    <select  data-rule="required" class="city form-control" name="city" data-url="region/area">
                    </select>
                    <select  data-rule="required" class="area form-control" name="district" data-url="region/area">
                    </select>
                </div>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><a style="color: red">*</a>{:__('Address')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-address" data-rule="required;length(~50)" class="form-control" name="row[address]" type="text" value="" placeholder="請輸入上門地點">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><a style="color: red">*</a>{:__('Arrivaltime')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-arrivaltime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[arrivaltime]" type="text" value="{:date('Y-m-d H:i:s')}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><a style="color: red">*</a>{:__('Returnvisittime')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-returnvisittime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[returnvisittime]" type="text" value="{:date('Y-m-d H:i:s')}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><a style="color: red">*</a>{:__('Workinghours')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-workinghours" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" data-rule="required;length(~10);range(1~)" class="form-control" name="row[workinghours]" type="number" value="" placeholder="請輸入工時">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><a style="color: red">*</a>{:__('Score')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-score" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" data-rule="required;length(~10);range(1~)" class="form-control" name="row[score]" type="number" value="" placeholder="請輸入積分">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><a style="color: red">*</a>{:__('Exp')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-exp" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" data-rule="required;length(~10);range(1~)" class="form-control" name="row[exp]" type="number" value="" placeholder="請輸入經驗">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><a style="color: red">*</a>{:__('Peoplenum')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-peoplenum" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" data-rule="required;length(~10);range(1~)" class="form-control" name="row[peoplenum]" type="number" value="" placeholder="請輸入人數">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script type="text/javascript">
    
    function removeParent(obj){
        $(obj).parent().remove();
        if ( $(".tag").length == 0 ) {
            $("#tag_f_div").hide();
        }else{
            $("#tag_f_div").show();
        }
    }
    function removeParents(obj){
        $(obj).parent().remove();
        if ( $(".tags").length == 0 ) {
            $("#tag_f_divs").hide();
        }else{
            $("#tag_f_divs").show();
        }
    }
</script>